import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

import java.io.FileOutputStream;
import java.io.IOException;

public class Demo2 {
    public static void main(String[] args) throws IOException {
        //创建工作簿
        XSSFWorkbook sheets = new XSSFWorkbook();
        //创建工作表
        XSSFSheet sheet=sheets.createSheet();
        //创建行
        XSSFRow row=sheet.createRow(0);
        row.createCell(0).setCellValue("1111");
        row.createCell(1).setCellValue("2222");
        row.createCell(2).setCellValue("3333");
        XSSFRow row1 =sheet.createRow(1);
        row1.createCell(0).setCellValue("1111");
        row1.createCell(1).setCellValue("2222");
        row1.createCell(2).setCellValue("3333");
        FileOutputStream out=new FileOutputStream("F:\\test1.xlsx");
        sheets.write(out);
        out.flush();
        out.close();
        sheets.close();
    }
}
